package com.tqjc.system.system.wrapper;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.tqjc.system.common.Wrapper.BaseWrapper;
import com.tqjc.system.system.entity.SysAreaInfoEntity;
import com.tqjc.system.system.entity.SysGateRecordEntity;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @description: 库区管理
 * @Author: 86195
 * @Date: 2023/12/26 9:54
 **/
public class AreaManageWrapper extends BaseWrapper<SysAreaInfoEntity> {


    public AreaManageWrapper(IPage<SysAreaInfoEntity> pageResult) {
        super(pageResult);
    }


    public AreaManageWrapper(List<SysAreaInfoEntity> pageResult) {
        super(pageResult);
        if(CollectionUtil.isNotEmpty(pageResult)){
            pageResult.forEach( e -> {
                if(StringUtils.isEmpty(e.getParentId())){
                    e.setParentId("-1");
                }
                if(StringUtils.isEmpty(e.getAreaName())){
                    e.setAreaName("");
                }
            });

        }

    }
}
